﻿<?php

    @session_start();
     if((isset($_SESSION["id"])) && ($_SESSION["id"] == "invite"))
     {
        include("template/headinvite.php");
     }
     else
     {
        include("template/head.php");    
     }
  //  include("template/menu_left.php");   
    include("submit/Articles/test_qte.php");
?>
    <div class="container-fluid">
        <div class="row-fluid">
         <?php 
        if((isset($_SESSION["id"])) && ($_SESSION["id"] == "invite"))
        
        {
         
            $span = 'span12';
        }
        else
        {
            include("template/menu_left.php");
            $span = 'span10';
        }
        
        echo '<div class="'.$span.'" id="content">';
            
				if ((isset($_GET["action"])) && ($_GET["action"] == "mail_sent"))
				{
				echo'
				<div class="alert alert-success" style="margin:10px 0 10px 0;">
					Email envoyé avec succèss <button type="button" class="close" data-dismiss="alert">&times;</button>
				</div>';
				}
				if ((isset($_GET["action"])) && ($_GET["action"] == "mail_error"))
				{
				echo'
				<div class="alert alert-danger" style="margin:10px 0 10px 0;">
					une erreur s\'est produit durant l\'envoie. <button type="button" class="close" data-dismiss="alert">&times;</button>
				</div>';
				}
				?>
				
            <div class="row-fluid">
			<!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Information <?php echo $row->ref_article; ?> </div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table class="table table-condensed table-hover">
						<thead>
							<tr>
								<th>Réference</th>
								<th>Type</th>
								<th>Emplacement</th>
								<th>Prix de Vente</th>
								<th>Date d'ajout</th>
							</tr>
						</thead>
						<tbody> 						
						<tr>
							<td><?php echo $row->ref_article; ?></td>
							<td><?php echo getTypeArticle($row->id_type); ?></td>
							<td><?php echo getLieu($row->id_lieu);?></td>
							<td><?php echo number_format($row->prix, 3, '.', ' ') ?></td>
							<td><?php 
							/*$dD = $row->date_add;
						    $datD =explode('/', $dD);
						    $dateD = $datD['1'].'/'.$datD['0'].'/'.$datD['2'];
									echo $dateD; */
									echo $row->date_add;
								?></td>
						</tr>
						</tbody>
						</table>
						<table cellpadding="0" cellspacing="0" border="0" class="table" style="margin-top: 20px;">
	                  	<thead>
	                      <tr>
	                        <th style="vertical-align: top;" class="span2">Désignation : </th>
	                        <th style="font-weight: normal;"><?php echo nl2br($row->designation); ?></th>
	                      </tr>
	                    </thead>
	                    <tbody>
	                    	<tr>
								<td style="vertical-align: top; font-weight: bold;">Observation : </td>
								<td style="vertical-align: top;"><?php echo nl2br($row->commentaire);  ?></td>
							</tr>
	                    </tbody>	
	                  </table>
					</table>
                </div>
              </div>
            </div>
        	<!-- /block -->
			<?php
			if ($user['account_login']=='none')
			{
			include 'submit/bloc_admin/fournisseur.php';
			}
			
			?>
			
        	
			<!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Quantité</div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table class="table table-condensed table-hover">
						<thead>
							<tr>
								<th  style="text-align:center;">Quantité en stock</th>
								<th  style="text-align:center;">Quantité Minimal</th>
								<th  style="text-align:center;">Unité de stockage</th>
							</tr>
						</thead>
						<tbody>    
							<tr>
								<td style="color:#d0343a;text-align:center;"><?php echo number_format($row->Quantite , 0, '', ' ')?></td>
								<td style="text-align:center;"><?php echo number_format($row->Qte_min , 0, '', ' ')?></td>
								<td style="text-align:center;"><?php echo getUnit($row->id_unite_stockage) ?></td>
							</tr>
						</tbody>
					</table>
                </div>
              </div>
            </div>
        	<!-- /block -->
			<?php
			if ($user['account_login']=='admin')
			{
			include 'submit/bloc_admin/historique_achat.php';
			}
			
			?>
			 <!-- block -->
            	<div>
					<div class="span4">	
					<a href="<?php echo $row->photo_name;?>" class="fancybox-effects-a" >
						<img src="<?php echo $row->photo_name;?>" style="width:300px;" class="img-polaroid"/>
					</a>
					</div>
					
					<?php 
					if ($user['account_login']=='admin')
					{
						echo '
					<div class="span8">

						<div class="alert alert-info alert-block span9">
							<a href="#" data-dismiss="alert" class="close">×</a>
							<h4 class="alert-heading">Prix d\'achat Moyen Pondéré TND :';  
								if($QteTotale!='0') 
								{
								$n = $QtexPrixDNT/$QteTotale ;
								$formatted = number_format($n, 3, '.', ' ');
								echo $formatted;
								}
								else {
									echo '0';
								}
								 
								 '</h4>
						</div>
					</div>	
				';
					}
				?> 
				</div>

				<div class="span3">
						<a class="btn btn-primary btn-sm" href="javascript:history.back()" style="float:right;margin-top:10px;width:119px;" >Retour</a>
				</div>
			<!--// block -->
			
          </div>
		</div>
        </div>
		<hr>
    </div>
<?php  include("template/footer.php") ; ?>